package com.xdwanj.dao;

import com.xdwanj.pojo.Commodity;
import com.xdwanj.util.PageBean;

import java.util.List;

public interface CommodityDao {
    /**
     * 查所有商品列表
     *
     * @return
     * @throws Exception
     */
    List<Commodity> findAll() throws Exception;

    /**
     * 添加单个商品
     *
     * @param commodity
     * @return
     * @throws Exception
     */
    int add(Commodity commodity, int catId) throws Exception;

    /**
     * 根据某个商品名字进行删除
     *
     * @param id
     * @return
     * @throws Exception
     */
    int delete(int id) throws Exception;

    /**
     * 根据 id修改数据
     *
     * @param commodity
     * @return
     * @throws Exception
     */
    int updateById(Commodity commodity, int catId) throws Exception;

    /**
     * 查商品类别
     *
     * @param name
     * @return
     * @throws Exception
     */
    PageBean<Commodity> findAllByCommodityAndCategory(String name, int pageSize, int currentPageNo, int categoryId) throws Exception;

    /**
     * 查商品类别
     *
     * @return
     * @throws Exception
     */
    Commodity findAllById(int id) throws Exception;

}
